﻿using System;
using System.Collections.Generic;
using System.Web.Http.Dependencies;
using PicShare.Server.Controllers;
using PicShare.Server.Factories;


namespace PicShare.Server.Resolvers
{
    public class DbDependencyResolver : IDependencyResolver
    {  
        public object GetService(Type serviceType)
        {
            if (serviceType == typeof(UsersController))
            {
                return ControllerFactory.CreateUsersController();
            }
            if (serviceType == typeof(ImageController))
            {
                return ControllerFactory.CreateImageController();
            }
            else
            {
                return null;
            }
        }

        public IEnumerable<object> GetServices(Type serviceType)
        {
            return new List<object>();
        }

        public IDependencyScope BeginScope()
        {
            return this;
        }
        public void Dispose()
        {

        }
    }
}